class FasematriculasController < ApplicationController
  # GET /fasematriculas
  # GET /fasematriculas.xml
  def index
    @fasematriculas = Fasematricula.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @fasematriculas }
    end
  end

  # GET /fasematriculas/1
  # GET /fasematriculas/1.xml
  def show
    @fasematricula = Fasematricula.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @fasematricula }
    end
  end

  # GET /fasematriculas/new
  # GET /fasematriculas/new.xml
  def new
    @fasematricula = Fasematricula.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @fasematricula }
    end
  end

  # GET /fasematriculas/1/edit
  def edit
    @fasematricula = Fasematricula.find(params[:id])
  end

  # POST /fasematriculas
  # POST /fasematriculas.xml
  def create
    @fasematricula = Fasematricula.new(params[:fasematricula])

    @fasematricula = modifica @fasematricula,params[:frasematricula]

    respond_to do |format|
      if @fasematricula.save
        flash[:notice] = 'Fasematricula was successfully created.'
        format.html { redirect_to(fasematriculas_url) }
        format.xml  { render :xml => @fasematricula, :status => :created, :location => @fasematricula }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @fasematricula.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /fasematriculas/1
  # PUT /fasematriculas/1.xml
  def update
    @fasematricula = Fasematricula.find(params[:id])

    respond_to do |format|
      if @fasematricula.update_attributes(params[:fasematricula])
        flash[:notice] = 'Fasematricula was successfully updated.'
        format.html { redirect_to(fasematriculas_url) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @fasematricula.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /fasematriculas/1
  # DELETE /fasematriculas/1.xml
  def destroy
    @fasematricula = Fasematricula.find(params[:id])
    @fasematricula.destroy

    respond_to do |format|
      format.html { redirect_to(fasematriculas_url) }
      format.xml  { head :ok }
    end
  end
end
